import request from "@/config/axios/service";

/**
 *  用户登录
 * @param {*} data 账号密码
 */
export function loginApi(data) {
  return request({
    url: `/Account/login`,
    method: "post",
    data,
  });
}

/**
 *  刷卡登录
 * @param {*} data
 */
export function loginByCardApi(data) {
  return request({
    url: "/Account/login/card",
    method: "post",
    data,
  });
}

/**
 *  刷新token
 */
export function refreshTokenApi() {
  return request({
    url: "/Account/login/refresh_token",
    method: "post",
  });
}

/**
 *  管理员重置密码
 * @param {*} id 用户id
 */
export function resetPwdApi(id, data) {
  return request({
    url: `/User/password/reset/${id}`,
    method: "put",
    data,
  });
}

/**
 *  用户修改密码
 * @param {*} data 账号密码
 */
export function updatePwdApi(data) {
  return request({
    url: `/User/password`,
    method: "put",
    data,
  });
}

/**
 *  获取登录用户信息、角色、菜单权限列表
 */
export function getUserInfoApi() {
  return request({
    url: `/Account`,
    method: "get",
  });
}

/**
 *  获取登录用户的动态菜单路由
 */
export function getAccessMenusApi() {
  return request({
    url: `/Account/router`,
    method: "get",
  });
}

/**
 *  用户退出
 */
export function logoutApi() {
  return request({
    url: `/Account/logout`,
    method: "post",
  });
}
